<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/modules/cms/front/include/taglib.jsp" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商家入驻</title>
    <meta name="description" content=" "/>
    <meta name="keywords" content=" "/>
    <link href="${ctxStatic}/merchant/css/shouye-new.css" rel="stylesheet" type="text/css">
    <link href="${ctxStatic}/merchant/css/index.css" rel="stylesheet" type="text/css">
    <script src="${ctxStatic}/merchant/js/jquery-3.3.1.min.js"></script>
    <script src="${ctxStatic}/jquery-jbox/2.3/jquery.jBox-2.3.min.js" type="text/javascript"></script>
    <script src="${ctxStatic}/merchant/js/Validform_v5.3.2.js"></script>
    <style type="text/css">
        .getCaptcha[disabled] {
            color: #999;
            cursor: not-allowed;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {

            if (isWeiXin()) {
                $("#re").html('<font color="red">暂不支持手机和微信内置浏览器,请勿在微信和QQ内部打开链接。</font>');
                $("#re").show();
                $('#phone').attr("readonly", "readonly");
                $("getCaptcha").attr("disabled", "true");
            }

            $("#login-btn").click(function () {
                $("#register").css('display', 'none');
                $("#login").css('display', 'block');
            });

            $("#register-btn").click(function () {
                $("#login").css('display', 'none');
                $("#register").css('display', 'block');
            });

            $("#forgetPwd").click(function () {
                window.location.href = "${fns:getFrontPath()}" + "/userForgetPassword";
            });

            //获取验证码
            $(".getCaptcha").click(function () {
                var phone = $("#phone").val();
                var validateCode = $(".pass #validateCode").val();
                $.post("${ctx}/yzm", {validateCode: validateCode, phone: phone}, function (result) {
                    if (result.status == 0) {
                        // $.jBox.alert("发送验证码成功");
                        $("#re").html('');
                        $("#re").html('<font color="red">验证码获取成功!</font>');
                        $("#re").show();
                        $('#phone').attr('readonly', "true");
                    }
                    else {
                        $("#re").html('');
                        $("#re").html('<font color="red">验证码获取失败，请您稍后重试!</font>');
                        $("#re").show();
                        // $.jBox.alert("发送验证码失败", "false");
                    }
                });

            });


            //注册
            /* $("#go").click(function () {
                 var phone = $("#phone").val();
                 var code = $("#code").val();
                 var validateCode = $(".pass #validateCode").val();
                 $.post("\\${ctx}/register", {
                     code: code,
                     phone: phone,
                     validateCode: validateCode
                 }, function (result) {
                     /!*console.log(result)*!/
                     /!* if (result.status == 0) {
                          //$.jBox.alert("注册失败", success);
                      }
                      else {
                          // $.jBox.alert("注册失败", error);
                      }*!/
                 });
             });*/


            //登录
            /*$("#loginBtn").click(function () {
                var username = $("#username").val();
                var password = $("#password").val();
                var validateCode = $(".vertify #validateCode").val();
                $.post("\\${ctx}/login", {
                    username: username,
                    password: password,
                    validateCode: validateCode
                }, function (result) {
                    if (result.status == 0) {
                        $.jBox.alert("登录成功", success);
                    }
                    else {
                        $.jBox.alert("登录失败", error);
                    }
                });
            });*/
        });

        function isWeiXin() {
            var sUserAgent = window.navigator.userAgent.toLowerCase();
            var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
            var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
            var bIsMidp = sUserAgent.match(/midp/i) == "midp";
            var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
            var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
            var bIsAndroid = sUserAgent.match(/android/i) == "android";
            var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
            var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
            var weiXin = sUserAgent.match(/MicroMessenger/i) == 'micromessenger';
            var qqBrows = sUserAgent.match(/QQ/i) == "qq";
            if (weiXin) {
                return true;
            } else {
                return false;
            }
        }

    </script>
</head>
<body>
<header class="head">
    <div class="logo">
        <img src="${ctxStatic}/merchant/images/shouye/logo.png">
        <img src="${ctxStatic}/merchant/images/shouye/slogan.png">
    </div>
    <nav class="nav">
        <ul>
            <li target='${fns:getFrontPath()}'>首页</li>
            <li class="active" target="${fns:getFrontPath()}/enter">商家入驻</li>
            <li target="${fns:getFrontPath()}/down">下载APP</li>
            <li target="${fns:getFrontPath()}/company">企业合作</li>
        </ul>
    </nav>
</header>
<div class="content">
    <div class="banner">
        <ul style="margin-right:580px;padding:0px;">
            <li><img src="${ctxStatic}/merchant/images/banner/r1.png"></li>
            <li><img src="${ctxStatic}/merchant/images/banner/r2.png"></li>
            <li><img src="${ctxStatic}/merchant/images/banner/r3.png"></li>
            <li><img src="${ctxStatic}/merchant/images/banner/r4.png"></li>
        </ul>
    </div>

    <%--注册--%>
    <form id="registerForm" action="${ctx}/register" method="post">
        <div class="login " id="register">
            <div class="title">新商户入驻</div>
            <div class="warn" style="visibility:hidden;">
                <span>您输入的手机号码不正确</span>
            </div>
            <input id="reValue" type="hidden" value="<%=request.getAttribute("isRegister")%>">
            <div id="re" style="display: none;">
                <font color="red"><%=request.getAttribute("isRegister")%>
                </font>
            </div>
            <div class="message">
                <input id="phone" name="phone" datatype="m" class="tel" placeholder="请输入手机号">
            </div>
            <div class="Validform_checktip"></div>
            <div class="pass">
                <sys:validateCode name="validateCode"
                                  inputCssStyle="margin-bottom:0;width: 169px; height: 48px; border: 1px solid #ccc; border-radius: 5px; padding-left: 14px;font-size: 16px;"
                />
            </div>
            <div class="pass">
                <input id="code" name="code" value="" class="captcha" datatype="*" placeholder="请输入短信验证码">
                <input type="button" value="获取验证码" class="getCaptcha">
            </div>
            <div class="Validform_checktip"></div>
            <div class="register-btn">
                <input id="go" class="btn_sub" type="submit" value="立即开店">
            </div>
            <div class="login-btn">
                <input type="button" id="login-btn" value="已有账号">
            </div>
        </div>
    </form>

    <form id="loginForm" action="${ctx}/login" method="post">
        <div class="login" id="login" style="display: none;">
            <div class="title">商户登录</div>
            <div class="warn" style="display: none;">
                <span>您输入的手机号码不正确</span>
            </div>
            <div class="message">
                <input id="username" name="username" datatype="m" class="tel" placeholder="请输入手机号">
            </div>
            <div class="Validform_checktip"></div>
            <div class="message">
                <input id="password" name="password" datatype="*" type="password" class="pass" placeholder="请输入登录密码">
            </div>
            <div class="Validform_checktip"></div>
            <div class="forgetPWD">
                <span id="forgetPwd">忘记密码</span>
            </div>
            <div class="vertify">
                <sys:validateCode name="validateCode"
                                  inputCssStyle="margin-bottom:0;width: 169px; height: 48px; border: 1px solid #ccc; border-radius: 5px; padding-left: 14px;font-size: 16px;"
                                  imageCssStyle="margin-top: 3px;"/>
            </div>
            <div class="register-btn">
                <input type="submit" id="loginBtn" value="登录">
            </div>
            <div class="login-btn">
                <input type="button" id="register-btn" value="新商户入驻">
            </div>
        </div>
    </form>
</div>
<div class="foot-link">
    <div class="link clearfix">
        <div class="qrCode">
            <div>
                <img src="${ctxStatic}/merchant/images/shouye/weixin.png">
                <span>扫描二维码微信关注</span>
            </div>
            <div>
                <img src="${ctxStatic}/merchant/images/shouye/app.png">
                <span>扫描二维码下载App</span>
            </div>

        </div>
        <div class="contactUs">
            <span>联系我们</span>
            <span>客服&举报电话：400-166-3828</span>
            <span>客服时间：9:00-20:00</span>
            <span>北京鸿坤泽厚信息技术有限公司</span>
        </div>
    </div>
    <div class="foot-nav">
        <ul class="clearfix">
            <li>商家入驻</li>
            <li>校园招聘</li>
            <li>关于我们</li>
            <li>帮助中心</li>
            <li>下载App</li>
            <li>消费者保障</li>
            <li>维权投诉</li>
            <li>廉正举报</li>
        </ul>
    </div>
</div>
<footer class="foot">
        <span>
            Copyright 2017-2018 lexiaozhuan.com 版权所有 (京ICP证030173号
        </span>
    <img src="${ctxStatic}/merchant/images/shouye/ghs.png">
    <span>
            京公网安备11000002000001号)
        </span>
</footer>
</body>
</html>
<!--banner轮播图插件-->
<script src="${ctxStatic}/merchant/js/jquery.terseBanner.min.js"></script>
<script src="${ctxStatic}/merchant/js/shouye.js"></script>
<script>

    if ($("#reValue").val() != "null" && $("#reValue").val() != "") {
        $("#re").show();
    }

    $("#registerForm").Validform({
        tiptype: 2,
        ajaxPost: false
    });


    $("#loginForm").Validform({
        tiptype: 2,
        ajaxPost: false
    });

    $(".getCaptcha").click(function () {
        $(this).attr('disabled', true);
        var time;
        clearInterval(time);
        var s = 60;
        var time = setInterval(function () {
            if (s > 0) {
                s--;
                $(".getCaptcha").val(s + "s");
            } else {
                $(".getCaptcha").removeAttr('disabled');
                $(".getCaptcha").val('获取验证码');

            }

        }, 1000);

    })

</script>